<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>潜在客户列表</title>
    <meta name="decorator" content="default"/>
    <link rel="stylesheet" href="${ctxStatic}/bootstrap-table/bootstrap-table.css">
    <style type="text/css">
    	.modal-header {padding: 8px 15px 8px 15px;}
    	.modal-footer {padding: 5px 15px 5px 15px;}
        .modal-body {padding: 0px 15px 0px 15px;}
        .open-close {height: 15px; width: 100%; text-align: center;cursor: pointer;}
        .breadcrumb {margin-bottom: 0px;}
    </style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/customer/potentialCustomer/">潜在客户列表</a></li>
	</ul>
	<form id="searchForm" action="${ctx}/customer/potentialCustomer/listAjaxData" method="post" class="breadcrumb form-search">
		<ul class="ul-form">
			<li><label>状态：</label>
				<select id="distStatus" name="distStatus" class="select-medium">
					<option value="">全部</option>
					<option selected="selected" value="UNDISTED">未分配</option>
					<option value="DISTED">已分配</option>
				</select>
			</li>
			<li><label>意向产品：</label>
				<sys:productType id="targetProducts" name="targetProducts" withWu="true"
                             withAll="true" cssClass="select-medium"></sys:productType>
			</li>
			<li><label>客户状态：</label>
				<sys:customerStatus id="customerStatusId" name="customerStatusId"
                              withAll="true" cssClass="select-medium"/>
			</li>

			<li><label>是否联系：</label>
				<select name="visitNum" class="select-medium">
					<option value="">全部</option>
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</li>
			<li><label>省份：</label>
				<sys:region id="provinceId" name="provinceId" withAll="true"
                                 cssClass="select-medium"></sys:region>
			</li>
			<li><label>来源设备：</label>
				<select name="mobileOrPc" class="select-medium">
					<option value="">全部</option>
					<c:forEach items="${fns:getDictList('POTENTIAL_SOURCE')}" var="ps">
						<option value="${ps.value }">${ps}</option>
					</c:forEach>
				</select>
			</li>
			<li><label>分组：</label>
				 <sys:treeselect id="realAdminGroupId" name="realAdminGroupId" value="${potentialAdminGroup.parent.id}" labelName="realAdminGroupName" labelValue="${potentialAdminGroup.parent.name}"
					title="分组" url="/customer/potentialAdminGroup/treeData" extId="${potentialAdminGroup.id}" cssClass="input-small" allowClear="true"/>
			</li>
			<li>
				<label>数据执行人：</label>
				 <sys:customerselect id="executorName" labelName="executorName" title="数据执行人" url="/customer/potentialCustomer/jumpToDistIndex" cssClass="input-small" allowClear="true"/>
				
				<!--input name="executorName" type="text" class="input-medium" /-->
			</li>
			<li class="clearfix"></li>
		</ul>
		<ul class="ul-form">
			<li><label>公司名称：</label>
				<select name="corporationNameOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="corporationName" type="text" class="input-medium" />
			</li>
			<li>
				<label>联系人：</label>
				<select name="contactorNameOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="contactorName" type="text" class="input-medium" />
			</li>
		</ul>
		<ul class="ul-form">
			<li>
				<label>手机号：</label>
				<select name="mobileOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="mobile" type="text" class="input-medium" />
			</li>
			<li><label>固定电话：</label>
				<select name="telephoneOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="telephone" type="text" class="input-medium" />
			</li>
		</ul>
		<ul class="ul-form">
			<li><label>一级来源：</label>
			    <select name="sourceOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="source" type="text" class="input-medium" />
			</li>
			<li><label>二级来源：</label>
				<select name="sourceDescOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="sourceDesc" type="text" class="input-medium" />
			</li>
		</ul>
		<ul class="ul-form">
			<li>
				<label>公司网址：</label>
				<select name="corporationUrlOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="corporationUrl" type="text" class="input-medium" />
			</li>
			<li>
				<label>邮箱：</label>
				<select name="emailOption" class="select-medium">
					<option value="1">包含</option>
					<option value="0">不包含</option>
				</select>
				<input name="email" type="text" class="input-medium" />
			</li>
		</ul>
		<ul class="ul-form">
			<li>
				<label style="width: 100px;">最新回访时间：</label>
				<select id="dateVisitOption" name="dateVisitOption" class="select-medium">
					<option value="2">之间</option>
					<option value="1">之前</option>
					<option value="0">之后</option>
				</select>
				<div class="input-prepend">
                	<span class="add-on">开始时间</span>
                    <input readonly="true" name="dateVisitBeginDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
        		</div>
        		<div id="dateVisitEndDate" class="input-prepend">
					<span class="add-on">结束时间</span>
                    <input readonly="true" name="dateVisitEndDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
        		</div>
			</li>
		</ul>
		<ul class="ul-form">
			<li>
				<label style="width: 100px;">预约回访时间：</label>
				<select id="dateAppointmentOption" name="dateAppointmentOption" class="select-medium">
					<option value="2">之间</option>
					<option value="1">之前</option>
					<option value="0">之后</option>
				</select>
				<div class="input-prepend">
                	<span class="add-on">开始时间</span>
                    <input readonly="true" name="dateAppointmentBeginDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
        		</div>
        		<div id="dateAppointmentEndDate" class="input-prepend">
               		<span class="add-on">结束时间</span>
                    <input readonly="true" name="dateAppointmentEndDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
        		</div>
			</li>
		</ul>
		<ul class="ul-form">
			<li>
				<label style="width: 100px;">最后分配时间：</label>
				<select id="distDateOption" name="distDateOption" class="select-medium">
					<option value="2">之间</option>
					<option value="1">之前</option>
					<option value="0">之后</option>
				</select>
				<div class="input-prepend">
                    <span class="add-on">开始时间</span>
                    <input readonly="true" name="distDateBeginDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
                <div id="distDateEndDate" class="input-prepend">
                    <span class="add-on">结束时间</span>
                    <input readonly="true" name="distDateEndDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
			</li>
			<li class="btns">
				<button type="button" id="btnSearch" onclick="refreshTableData();" class="btn btn-primary">查询 &nbsp;<i class="icon-search icon-white"></i></button>
			</li>
		</ul>
	</form>
	<div class="open-close"><i class="fa-chevron-up"></i></div>
	<table id="contentTable" data-url="${ctx}/customer/potentialCustomer/listAjaxData">
		<thead>
			<tr>
				<th colspan="12">
					<ul class="nav nav-toolbar">
						<li class="show-ctrl"><a id="aDist" data-url="${ctx}/customer/potentialCustomer/jumpToDistIndex" href="javascript:void(0);">分配</a></li>
						<li class="show-ctrl">|</li>
						<li class="show-ctrl"><a id="aGroup" data-url="${ctx}/customer/potentialAdminGroup" href="javascript:void(0);">分组</a></li>
						<li class="show-ctrl">|</li>
						<li class="show-ctrl"><a id="aMerger" href="javascript:void(0);">合并</a></li>
						<li class="show-ctrl">|</li>
						<li class="show-ctrl"><a id="aBatchEdit" data-url="${ctx}/customer/potentialCustomer/jumpToBatchEdit" href="javascript:void(0);">批量修改</a></li>
						<li class="show-ctrl">|</li>
						<li class="show-ctrl2" style="display:none;"><a id="aRecovery" data-url="${ctx}/customer/potentialCustomer/recovery" href="javascript:void(0);">回收</a></li>
						<li class="show-ctrl2" style="display:none;">|</li>
						<c:if test="${fns:getUser().admin}">
							<li><a id="aDel" data-url="${ctx}/customer/potentialCustomer/delete" href="javascript:void(0);">删除</a></li>
							<li>|</li>
						</c:if>
						<li><a id="aExport" data-url="${ctx}/customer/potentialCustomer/exportData" href="javascript:void(0);">导出</a></li>
					</ul>
				</th>
			</tr>
			<tr>
				<th data-field="state" data-checkbox="true" data-align="center"></th>
				<th data-field="dataStatus" data-align="left" data-formatter="dataStatusFormatter">重复数据（新）</th>
				<th data-field="lastUpdated" data-align="left" >更新时间</th>
				<th data-field="corporationName" data-align="left" data-formatter="corporationNameFormatter" >公司名称</th>
				<th data-field="targetProducts" data-align="left" data-formatter="targetProductsFormatter" >意向产品</th>
				<th data-field="customerStatus" data-align="left" >客户状态</th>
				<th data-field="lastCustomerStatus" data-align="left" >上次客户状态</th>
				<th data-field="dateVisit" data-align="left" >最后跟进时间</th>
				<th data-field="distStatus" data-align="left" data-formatter="distStatusFormatter" >分配状态</th>
				<th data-field="mobileOrPcText" data-align="left" >来源设备</th>
				<th data-field="dateAppointment" data-align="left" >预约回访时间</th>
				<th data-field="contact" data-align="left">是否联系</th>
			</tr>
		</thead>
	</table>
	<div id="distModal" class="modal hide fade" style="width: 700px; margin-left: -350px;top: 0px;"  tabindex="-1" role="dialog" aria-labelledby="distModalLabel" aria-hidden="true">
  		<div class="modal-header">
    		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    		<h5 id="distModalLabel">选择人员</h5>
	  	</div>
	  	<div class="modal-body" style="height: 400px;max-height: 350px;overflow: hidden;" >
	  		<iframe id="distPage" name="distPage" style="width: 100%;border: none;height: 350px;margin: 0px;"></iframe>
	  	</div>
	  	<div class="modal-footer">
	    	<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
	    	<button id="btnDist" data-url="${ctx}/customer/potentialCustomer/distData" class="btn btn-primary">确定</button>
	  	</div>
	</div>
	<div id="groupModal" class="modal hide fade" style="width: 500px; margin-left: -250px;top: 0px;"  tabindex="-1" role="dialog" aria-labelledby="groupModalLabel" aria-hidden="true">
  		<div class="modal-header">
    		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    		<h5 id="groupModalLabel">数据分组</h5>
	  	</div>
	  	<div class="modal-body" style="height: auto;" >
	  		<div style="text-align: center;">
	  			<iframe id="groupPage" name="groupPage" style="width: 100%;border: none;height: 350px;"></iframe>
	  		</div>
	  	</div>
	  	<div class="modal-footer">
	    	<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
	    	<button id="btnGroup" data-url="${ctx}/customer/potentialCustomer/adminGroupData" class="btn btn-primary">确定</button>
	  	</div>
	</div>
	<div id="mergerModal" class="modal hide fade" style="width: 750px; margin-left: -350px;top: 0px;"  tabindex="-1" role="dialog" aria-labelledby="mergerModalLabel" aria-hidden="true">
  		<div class="modal-header">
    		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    		<h5 id="mergerModalLabel">数据合并</h5>
	  	</div>
	  	<div class="modal-body" style="width: auto;" >
	  		<div style="text-align: center; height: auto;">
	  			<table id="mergerTable" class="table table-condensed table-hover table-striped" data-single-select="true">
					<thead>
						<tr>
							<th data-checkbox="true" data-align="center"></th>
                            <th data-field="corporationName" data-align="left" >客户名称</th>
                            <th data-field="corporationUrl" data-align="left">公司网址</th>
							<th data-field="phone" data-align="left" >公司电话</th>
							<th data-field="mobile" data-align="left">手机号码</th>
							<th data-field="dateCreated" data-align="left" >创建日期</th>
						</tr>
					</thead>
				</table>
	  		</div>
	  	</div>
	  	<div class="modal-footer">
	    	<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
	    	<button id="btnMerger" data-url="${ctx}/customer/potentialCustomer/mergerData" class="btn btn-primary">确定</button>
	  	</div>
	</div>
	<div id="batchEditModal" class="modal hide fade" style="top: 5%"  tabindex="-1" role="dialog" aria-labelledby="batchEditModalLabel" aria-hidden="true">
  		<div class="modal-header">
    		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    		<h5 id="batchEditModalLabel">批量修改</h5>
	  	</div>
	  	<div class="modal-body" style="height: auto;" >
	  		<div style="text-align: center;">
	  			<iframe id="batchEditPage" name="batchEditPage" style="width: 100%;border: none;height: 380px"></iframe>
	  		</div>
	  	</div>
	  	<div class="modal-footer">
	    	<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
	    	<button id="btnbatchEdit" data-editurl="${ctx}/customer/potentialCustomer/batchEditData" 
	    	class="btn btn-primary">确定</button>
	  	</div>
	</div>
	<script src="${ctxStatic}/bootstrap-table/bootstrap-table.js"></script>
    <script src="${ctxStatic}/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="${ctxStatic}/bootstrap-table/config.js"></script>
    <script src="${ctxStatic}/modules/potentialcustomer/potentialCustomerList.js"></script>
</body>
</html>